package core.network.client2game.handler.tdk;

import business.global.pk.tdk.TDKRoom;
import business.global.room.RoomMgr;
import business.player.Player;
import com.ddm.server.websocket.def.ErrorCode;
import com.ddm.server.websocket.handler.requset.WebSocketRequest;
import com.google.gson.Gson;
import core.network.client2game.handler.PlayerHandler;
import jsproto.c2s.iclass.room.CBase_GetRoomInfo;

import java.io.IOException;

/**
 * 济宁
 * @author Administrator
 *
 */
public class CTDKRoomEndResult extends PlayerHandler {
	

    @Override
    public void handle(Player player, WebSocketRequest request, String message) throws IOException {
		final CBase_GetRoomInfo req = new Gson().fromJson(message, CBase_GetRoomInfo.class);
		long roomID = req.getRoomID();

		TDKRoom room = (TDKRoom) RoomMgr.getInstance().getRoom(roomID);
		if (null == room){
			request.error(ErrorCode.NotAllow, "CTDKRoomEndResult not find room:"+roomID);
			return;
		}
		request.response(room.getRoomEndResult());
    }
}
